package com.epam.tcs.test;

import com.epam.tcs.dao.factory.DAO;
import com.epam.tcs.dao.factory.DAOFactory;
import com.epam.tcs.dao.hibernate.entities.*;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			
			DAO<Lecture> lectureDAO = DAOFactory.getDaoFactory()
					.getLectureDAO();
			for (Lecture item : lectureDAO.getAllElements()) {
				System.out.println("Lecture: " + item.getName());
			}

			DAO<Practice> practiceDAO = DAOFactory.getDaoFactory()
					.getPracticeDAO();
			for (Practice item : practiceDAO.getAllElements()) {
				System.out.println("Practice: " + item.getName());
			}

			DAO<Theme> themeDAO = DAOFactory.getDaoFactory().getThemeDAO();
			for (Theme item : themeDAO.getAllElements()) {
				System.out.println("Theme name: " + item.getName());
				
				for (ThemeItem pracItem : item.getPractices()) {
					System.out.println("Theme practice: " + pracItem.getName());
				}
				
				for (ThemeItem lecItem : item.getLectures()) {
					System.out.println("Theme Lecture: " + lecItem.getName());
				}
			}

			// DAO<Student> studentDAO = DAOFactory.getDaoFactory()
			// .getStudentDAO();
			// System.out.println(studentDAO);
			// for (Student item : studentDAO.getAllElements()) {
			// System.out.println("Student name is: " + item.getFirstName());
			// }
			// //DAO<Group> group = DAOFactory.getDaoFactory().getGroupDAO();
			// for (Group g: group.getAllElements()) {
			// System.out.println("Group name is: " + g.getName());
			// }

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
